import java.util.Scanner;

import java.util.Arrays;
abstract class Test {
    public abstract void a();
}

// 注意类名必须为 Main, 不要有任何 package xxx 信息
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            int n = Integer.parseInt(in.nextLine());
            String s = in.nextLine();
            long[] ans = new long[n];
            String[] tmp = s.split(" ");
            for(int i=0; i<n; i++){
                ans[i] = Long.parseLong(tmp[i]);
            }
            int res = 1;
            for(int left=0, right=1; right < n-1; right++){
                if((ans[right]-ans[left])*(ans[right+1]-ans[right])<0){
                    res++;
                    left = right + 1;
                }
            }
            System.out.println(res);
        }
    }
}
class Solution {
    public int distMoney(int money, int children) {
        if(money < children) return -1;
        int ans = 0;
        while(money-8 >= children-1 && children-1 >= 0){
            money -= 8;
            children -= 1;
            ans++;
        }
        if(money == 4 && children == 1)
            ans--;
        if(children==0 && money > 0)
            ans--;
        return ans;
    }
}